package com.linwen.excise.sort;
import org.junit.Test;

import  static com.linwen.javase.MyPrint.*;
/**
 * 测试
 * @author lin
 *
 */
public class TestSort {

	@Test
	public void testSelectionSort() {
		_01SelectionSort selectionSort = new _01SelectionSort();
		int arr[] = new int[]{4, 3, 5, 6, 1, 8, 9, 2, 7};
		selectionSort.selectionSort(arr);
		for (int i = 0; i < arr.length; i++) {
			System.out.print(arr[i] + "   ");
		}
	}

	@Test
	public void testBubbleSort() {
		_02BubbleSort bubbleSort = new _02BubbleSort();
		int[] arr = new int[]{3, 1, 2, 5, 6, 7, 4, 8, 9};
		bubbleSort.bubbleSort(arr);
		for (int i = 0; i < arr.length; i++) {
			System.out.print(arr[i] + "   ");
		}
		System.out.println();
		int[] arr1 = new int[]{1, 2, 3, 4, 5, 6, 7, 10, 9};
		bubbleSort.bubbleSortafter(arr1);
		for (int i = 0; i < arr.length; i++) {
			System.out.print(arr[i] + "   ");
		}
	}

	@Test
	public void testInsertSort() {
		_03InsertSort insertSort = new _03InsertSort();
		int[] arr = new int[]{3, 2, 5, 6, 4, 1, 7, 9, 8};
		insertSort.insertSort(arr);
		for (int i = 0; i < arr.length; i++) {
			System.out.print(arr[i] + "  ");
		}
	}


	@Test
	public void testMergeSort() {
		_05MergeSort mergeSort = new _05MergeSort();
		int[] arr = new int[]{3, 2, 5, 6, 4, 1, 7, 9, 8};
		mergeSort.mergeSort(arr);
		for (int i = 0; i < arr.length; i++) {
			System.out.print(arr[i] + "  ");
		}
	}
}
